import axios from "axios";
axios.defaults.withCredentials = false;

let defaultBaseURL = "http://localhost:8081";

function Get(path, params, token = '') {
  let instance = axios.create({
    baseURL: defaultBaseURL,// 换成你自己后台地址
    headers: {
      Token: token
    }
  });
  return instance({
    url: path,
    method: "get",
    params: params
  });
}
function Post(path, data, token = '') {
  let instance = axios.create({
    baseURL: defaultBaseURL,// 换成你自己后台地址
    headers: {
      Token: token
    }
  });
  return instance({
    url: path,
    method: "post",
    data: data
  });
}
function Put(path, data, token = '') {
  let instance = axios.create({
    baseURL: defaultBaseURL,// 换成你自己后台地址
    headers: {
      Token: token
    }
  });
  return instance({
    url: path,
    method: "put",
    data: data
  });
}
function Delete(path, params, token = '') {
  let instance = axios.create({
    baseURL: defaultBaseURL,// 换成你自己后台地址
    headers: {
      Token: token
    }
  });
  return instance({
    url: path,
    method: "delete",
    params: params
  });
}
export { Get, Post, Put, Delete };
